#ifndef _CONNECTIONPOINT_H_
#define _CONNECTIONPOINT_H_

#include <dlcom/byunknown.hpp>
#include <dlcom/comsentry.hpp>

namespace by {

typedef struct tagCONNECTDATA
{
	com_ptr<IBase> pUnk;
	DWORD dwCookie;
} CONNECTDATA;

typedef CONNECTDATA *LPCONNECTDATA;

interface IEnumConnections : public IBase
{
public:
	STDMETHOD(Next)(ULONG cConnections, LPCONNECTDATA rgcd, ULONG *pcFetched) = 0;
	STDMETHOD(Skip)(ULONG cConnections) = 0;
	STDMETHOD(Reset)(void) = 0;
	STDMETHOD(Clone)(IEnumConnections **ppEnum) = 0;
};
_DEFINE_IID(IEnumConnections, "{966C3BF0-2452-4741-A5EB-0FE3C897B66D}");

interface IConnectionPointContainer;

interface IConnectionPoint : public IBase
{
public:
	STDMETHOD(GetConnectionInterface)(IID *pIID) = 0;
	STDMETHOD(GetConnectionPointContainer)(IConnectionPointContainer **ppCPC) = 0;
	STDMETHOD(Advise)(IBase *pUnkSink, DWORD *pdwCookie) = 0;
	STDMETHOD(Unadvise)(DWORD dwCookie) = 0;
	STDMETHOD(EnumConnections)(IEnumConnections **ppEnum) = 0;
};
typedef IConnectionPoint *LPCONNECTIONPOINT;

_DEFINE_IID(IConnectionPoint, "{FA053C5F-9CDE-4d43-BE8D-BF9C8D6B3BC1}");

//////////////////////////////////////////////////////////////////////////
interface IEnumConnectionPoints : public IBase
{
public:
	STDMETHOD(Next)( ULONG cConnections,LPCONNECTIONPOINT *ppCP, ULONG *pcFetched) = 0;
	STDMETHOD(Skip)( ULONG cConnections ) = 0;
	STDMETHOD(Reset)( void) = 0;
	STDMETHOD(Clone)(IEnumConnectionPoints **ppEnum) = 0;
};
_DEFINE_IID(IEnumConnectionPoints, "{720E4D89-F10F-472b-9B0C-0FE9F881D448}");

interface IConnectionPointContainer : public IBase
{
	STDMETHOD(EnumConnectionPoints)(IEnumConnectionPoints **ppEnum) = 0;
	STDMETHOD(FindConnectionPoint)(REFIID riid, IConnectionPoint **ppCP) = 0;
};
_DEFINE_IID(IConnectionPointContainer, "{EA3E2924-A205-41a3-85DE-40DABD266745}");

} 
#endif 